﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace WpfToolkit
{
    public class ThreeStateRadioButton : RadioButton
    {
        public ThreeStateRadioButton()
        {
            this.DefaultStyleKey = typeof(ThreeStateRadioButton);
        }

        protected override void OnClick()
        {
            if (this.IsChecked == true)
            {
                this.IsChecked = false;
                VisualStateManager.GoToState(this, "UnChecked", true);
            }
            else
            {
                this.IsChecked = true;
                VisualStateManager.GoToState(this, "Checked", true);
            }
            //else if (this.IsChecked == false)
            //{
            //    this.IsChecked = null;
            //    VisualStateManager.GoToState(this, "Indeterminate", true);
            //}
            //else if (this.IsChecked == null)
            //{
            //    this.IsChecked = true;
            //    VisualStateManager.GoToState(this, "Checked", true);
            //}
        }
    }
}
